import Vue from 'vue'
import App from './App'
import {$http} from '@escook/request-miniprogram/miniprogram_dist'
import store from '@/store/store.js'
import uView from "uview-ui";
import service from 'api/http.js'
Vue.use(uView);

Vue.config.productionTip = false
Vue.prototype.$axios = service

uni.$http = $http

$http.baseUrl = 'https://www.uinav.com'

$http.beforeRequest = function(options) { //请求拦截器
	options.header.notShow || uni.showLoading({
		title: '加载中'
	})
}

$http.afterRequest = function(res) { //响应拦截器
	uni.hideLoading()
}

uni.$showMsg = function(title = '数据获取失败', duration = 1500) {
	uni.showToast({
		title,
		duration,
		icon: 'none'
	})
}

App.mpType = 'app'

const app = new Vue({
	...App,
	store,
})
app.$mount()
